package com.wyj.util;

import com.wyj.pojo.User;
import org.springframework.stereotype.Component;
import org.springframework.stereotype.Controller;

import java.net.UnknownServiceException;

/**
 * @author 王永杰
 * @Description 描述该类的做什么用
 * @since 2022/7/7
 */
@Component
public class HostHolder {

    private ThreadLocal<User> users  = new ThreadLocal<>();

    public void setUser(User user) {
        users.set(user);
    }

    public User getUser() {
        return users.get();
    }

    public void clear() {
        users.remove();
    }

}
